package io.zcoder.innoway.rest;


import io.zcoder.innoway.models.Dashboard;
import io.zcoder.innoway.models.DashboardResponse;
import io.zcoder.innoway.models.EntryTimeResponse;
import io.zcoder.innoway.models.ProfileDetailResponse;
import io.zcoder.innoway.models.ProfilesResponse;
import io.zcoder.innoway.models.ResponseBase;
import io.zcoder.innoway.models.User;
import io.zcoder.innoway.models.UserResponse;
import retrofit.Callback;
import retrofit.http.Body;
import retrofit.http.DELETE;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.GET;
import retrofit.http.Header;
import retrofit.http.Headers;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Part;
import retrofit.http.Path;
import retrofit.http.Query;
import retrofit.mime.TypedFile;

public interface ApiService {

    @POST("/users")
    void createUser(@Body User user, Callback<UserResponse> callback);

    @GET("/profiles")
    void getProfileMembers(Callback<ProfilesResponse> callback);

    @FormUrlEncoded
    @POST("/users/login")
    void login(@Field("email") String email, @Field("password") String password,Callback<UserResponse> callback);

    @FormUrlEncoded
    @POST("/users/login_by")
    void loginBy(@Field("type") int type, @Field("token") String token, @Field("secret") String secret,Callback<UserResponse> callback);

    @FormUrlEncoded
    @POST("/users/reset_password")
    void resetPassword(@Field("email") String email,Callback<ResponseBase> callback);

    @GET("/profiles/{id}")
    void getProfile(@Path("id") int id, Callback<ProfileDetailResponse> callback);

    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void saveWeightUnit(@Path("id") int id, @Field("weight_unit") int unit, Callback<ResponseBase> callback);

    @Multipart
    @PUT("/profiles/{id}")
    void uploadAvatar(@Path("id") int id, @Part("avatar") TypedFile avatar, Callback<ResponseBase> callback);

    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void saveEditInfo(@Path("id") int id, @Field("height") float height,
                      @Field("height_unit") float height_unit,
                      @Field("birthday") String birthday,
                      @Field("first_name") String first_name,
                      @Field("last_name") String last_name,
                      @Field("init_weight") float initWeight,
                      Callback<ResponseBase> callback);



    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void saveBodyType(@Path("id") int id, @Field("body_type") int body_type, Callback<ResponseBase> callback);

    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void setPasscode(@Path("id") int id, @Field("passcode") String passcode, Callback<ResponseBase> callback);

    @FormUrlEncoded
    @DELETE("/profiles/{id}")
    void deleteUser(@Path("id") int id, Callback<ResponseBase> callback);

    @DELETE("/users/reset")
    void resetUser(Callback<ResponseBase> callback);

    @FormUrlEncoded
    @POST("/users/logout")
    void logout(@Field("os") int os, @Field("device_token") String s, Callback<ResponseBase> callback);

    @FormUrlEncoded
    @POST("/profiles")
    void addProfile(@Field("first_name") String first_name,
                    @Field("last_name") String last_name,
                    @Field("passcode") String passcode,
                    @Field("height") int height,
                    @Field("gender") boolean gender,
                    @Field("birthday") String birthday,
                    @Field("relation") int relation,
                    Callback<ProfileDetailResponse> callback);

    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void updateProfile(@Path("id") int profileId,
                    @Field("first_name") String first_name,
                    @Field("last_name") String last_name,
                    @Field("passcode") String passcode,
                    @Field("height") int height,
                    @Field("gender") boolean gender,
                    @Field("birthday") String birthday,
                    Callback<ProfileDetailResponse> callback);

    @GET("/entries/dashboard")
    void getDashboard(@Query("profile_id") int id, Callback<DashboardResponse> callback);

    @POST("/entries")
    void addEntry(@Body Dashboard dashboard, Callback<ResponseBase> callback);

    @GET("/entries")
    void getEntryTime(@Query("profile_id") int id, @Query("start_time") String start_time,
                      @Query("end_time") String end_time, @Query("type") String type, @Query("group_by") String group_by,
                      Callback<EntryTimeResponse> callback);

    @GET("/entries")
    void getEntryTimeOfMonth(@Query("profile_id") int id, @Query("start_time") String start_time,
                             @Query("end_time") String end_time, @Query("type") String type,
                             Callback<EntryTimeResponse> callback);

    @DELETE("/entries/{id}")
    void deleteEntry(@Path("id") int id, @Query("profile_id") int profile_id,
                     Callback<ResponseBase> callback);

    @FormUrlEncoded
    @PUT("/profiles/{id}")
    void setGoal(@Path("id") int id, @Field("goal_weight") float goal_weight,
                 Callback<ResponseBase> callback);

    @FormUrlEncoded
    @PUT("/users/{id}")
    void changePassword(@Path("id") int id, @Field("old_password") String old_password,
                        @Field("password") String password, Callback<UserResponse> callback);
}
